<script>
    //ajax提交数据
    function doAjaxSubmit(form, win = parent, isLogin = false) {
        var url = form.data("url");
        var index = layer.load();
        $.ajax({
            url: url,
            type: 'post',
            data: form.serialize(),
            dataType: 'json',
            success(res) {
                if (res.code == 1) {
                    if (isLogin) {
                        layer.msg(res.msg, {
                            icon: 1,
                            time: 1000
                        }, function(){
                            window.location.href = res.url
                        });
                    } else {
                        parent.layer.closeAll();
                        //刷新表格
                        parent.table.reload('app');
                        //提示成功
                        parent.layer.msg(res.msg, { icon: 1 });
                    }
                } else {
                    layer.msg(res.msg, {
                        icon: 5,
                        shift: 6
                    });
                }
            },
            complete() {
                layer.close(index)
            }
        });
    }

</script>